<template>
  <div id="show">
    <img alt="Vue logo" src="../assets/1.jpg" /><br />
    用户名：<input type="text" v-model="userName" /><br />
    密码：<input type="text" v-model="userPwd" /><br />
    <input type="button" value="登陆" @click="login()" />
  </div>
</template>

<script>
export default {
  name: "App",
  components: {},
  data() {
    return {
      userName: "",
      userPwd: "",
    };
  },
  methods: {
    async login() {
      let paramObj = { userName: this.userName, userPwd: this.userPwd };
      let info = await this.ajax.getSubmit("/api/user/login", paramObj);
      //console.log(info);
      if (info != null && info != "") {
        //不使用路由链接去跳转页面
        this.$router.push("/home");
      }
    },
  },
};
</script>

<style>
#show {
  width: 350px;
  margin: 100px auto;
}
#show input {
  margin-top: 20px;
}
</style>